package com.ouc.openplatform.zykt.standardManage.service.impl;

import java.util.List;

import com.ouc.openplatform.zykt.standardManage.dao.NJ_TestBOMDAO;
import com.ouc.openplatform.zykt.standardManage.model.NJ_TestBOM;
import com.ouc.openplatform.zykt.standardManage.model.NJ_TestStandardUnion;
import com.ouc.openplatform.zykt.standardManage.service.NJ_TestBOMService;

	

public class NJ_TestBOMServiceImpl implements NJ_TestBOMService {

	NJ_TestBOMDAO testBOMDAO;

	public NJ_TestBOMDAO getTestBOMDAO() {
		return testBOMDAO;
	}

	public void setTestBOMDAO(NJ_TestBOMDAO testBOMDAO) {
		this.testBOMDAO = testBOMDAO;
	}

	@Override
	public List<NJ_TestBOM> searchAllTestBOM(int startIndex, int endIndex) {
		// TODO Auto-generated method stub
		return testBOMDAO.searchAllTestBOM(startIndex, endIndex);
	}

	@Override
	public List<NJ_TestBOM> searchTestBOMByCondition(String pd_type,
			String test_type, String test_grade, String venture, String area,
			int startIndex, int endIndex) {
		// TODO Auto-generated method stub
		return testBOMDAO.searchTestBOMByCondition(pd_type, test_type,
				test_grade, venture, area, startIndex, endIndex);
	}

	@Override
	public int insertTestBOM(NJ_TestBOM testBOM) {
		// TODO Auto-generated method stub
		int result = 0;
		int tmp = checkName(testBOM);

		System.out.println("StdCode:" + testBOM.getStdCode());
		System.out.println("StdName:" + testBOM.getStdName());
		System.out.println("StdItermCode:" + testBOM.getStdItermCode());
		System.out.println("StdItermName:" + testBOM.getStdItermName());
		System.out.println("StdSubitermCode:" + testBOM.getStdSubitermCode());
		System.out.println("StdSubitermName:" + testBOM.getStdSubitermName());

		if (tmp == 0) {
			result = testBOMDAO.insertTestBOM(testBOM);
		}
		if (tmp != 0) {
			result = 7;
		}

		System.out.println("result:" + result);
		System.out.println("tmp:" + tmp);

		return result;
	}

	@Override
	public int editTestBOM(NJ_TestBOM testBOM) {
		// TODO Auto-generated method stub
		return testBOMDAO.editTestBOM(testBOM);
	}

	@Override
	public int deleteTestBOM(int id) {
		// TODO Auto-generated method stub
		return testBOMDAO.deleteTestBOM(id);
	}

	@Override
	public int getSearchAllTestBOMCount() {
		// TODO Auto-generated method stub
		return testBOMDAO.getSearchAllTestBOMCount();
	}

	@Override
	public int getSearchTestBOMByConditionCount(String pd_type,
			String test_type, String test_grade, String venture, String area) {
		// TODO Auto-generated method stub
		return testBOMDAO.getSearchTestBOMByConditionCount(pd_type, test_type,
				test_grade, venture, area);
	}

	@Override
	public List<NJ_TestBOM> getAllTestBOM() {
		// TODO Auto-generated method stub
		return testBOMDAO.getAllTestBOM();
	}

	@Override
	public List<NJ_TestBOM> getTestBOMByCondition(String pd_type,
			String test_type, String test_grade, String venture, String area) {
		// TODO Auto-generated method stub
		return testBOMDAO.getTestBOMByCondition(pd_type, test_type, test_grade,
				venture, area);
	}

	@Override
	public List<NJ_TestStandardUnion> getAllTestStandardUnion() {
		// TODO Auto-generated method stub
		return testBOMDAO.getAllTestStandardUnion();
	}

	@Override
	public List<NJ_TestStandardUnion> getAllTestStandardUnionByCondition(
			int template_id, int item_id) {
		// TODO Auto-generated method stub
		return testBOMDAO.getAllTestStandardUnionByCondition(template_id,
				item_id);
	}

	@Override
	public int checkName(NJ_TestBOM testBOM) {
		//
		return testBOMDAO.checkName(testBOM);
	}

	@Override
	public List<NJ_TestStandardUnion> getAllTestStandardUnionByNames(
			String template_name, String item_name) {
		// TODO Auto-generated method stub
		return testBOMDAO.getAllTestStandardUnionByNames(template_name, item_name);
	}

}
